<?PHP
    header("Content-Type: text/html; charset=utf8");
    if(!isset($_POST["submit"])){
        exit("错误执行");
    }//检测是否有submit操作 
    $name =$_POST['name'];
    echo $name."<br>";
    $password= $_POST['password'];
    echo $password."<br>";
    $QQnumble= $_POST['QQnumble'];
    echo $QQnumble."<br>";
    $qqmail = $QQnumble."@qq.com";
    echo $qqmail."<br>";
    function getRealIp() {
	static $realip = null;
	if($realip !== null) {
		return $realip;
	}
 
	if(getenv('REMOTE_ADDR')) {
		$realip = getenv('REMOTE_ADDR');
	} else if(getenv('HTTP_CLIENT_IP')) {
		$realip = getenv('HTTP_CLIENT_IP');
	} else if (getenv('HTTP_X_FROWARD_FOR')) {
		$realip = getenv('HTTP_X_FROWARD_FOR');
	}
 
	return $realip;	
}
$ip=getRealIp();
echo $ip."<br>";

include('connect.php');//链接数据库
$sql = "insert into `user` (username, passwd,ip,QQmail) VALUES  ('$name', '$password', '$ip','$qqmail')";
$result = mysql_query($sql);//执行sql
if($result!=1)
{
    echo "你的设备或者qq号已经注册";
}
include('send.php');
if($result)
{
 sc_send("注册成功",$name."<br>".$qqmail,"html","sys");   
}

mysql_close();
?>